"advapi32-sys 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"curl 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"docopt 0.6.31 (registry+https://github.com/rust-lang/crates.io-index)",
+ "env_logger 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"git2 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
- "log 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"registry 0.1.0",
"rustc-serialize 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "env_logger"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "log 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "flate2"
version = "0.1.6"
"regex 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "log"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
[[package]]
name = "matches"
version = "0.1.2"
git2 = "0.1"
glob = "0.1"
time = "0.1"
-log = "0.1"
+log = "0.2"
+env_logger = "0.2"
docopt = "0.6"
url = "0.2"
rustc-serialize = "0.2"
extern crate "rustc-serialize" as rustc_serialize;
extern crate cargo;
#[macro_use] extern crate log;
+extern crate env_logger;
use std::collections::BTreeSet;
use std::os;
";
fn main() {
+ env_logger::init().unwrap();
execute_main_without_stdin(execute, true, USAGE)
}
}
pub fn get(&mut self, package_ids: &[PackageId]) -> CargoResult<Vec<Package>> {
- log!(5, "getting packages; sources={}", self.sources.len());
+ trace!("getting packages; sources={}", self.sources.len());
// TODO: Only call source with package ID if the package came from the
// source
/// Builds the list of all packages required to build the first argument.
pub fn resolve(summary: &Summary, method: Method,
registry: &mut Registry) -> CargoResult<Resolve> {
- log!(5, "resolve; summary={}", summary.get_package_id());
+ trace!("resolve; summary={}", summary.get_package_id());
let summary = Rc::new(summary.clone());
let cx = Box::new(Context {
let key = (dep.get_name().to_string(), dep.get_source_id().clone());
let prev_active = cx.activations.get(&key)
.map(|v| v.as_slice()).unwrap_or(&[]);
- log!(5, "{}[{}]>{} {} candidates", parent.get_name(), cur, dep.get_name(),
+ trace!("{}[{}]>{} {} candidates", parent.get_name(), cur, dep.get_name(),
candidates.len());
- log!(5, "{}[{}]>{} {} prev activations", parent.get_name(), cur,
+ trace!("{}[{}]>{} {} prev activations", parent.get_name(), cur,
dep.get_name(), prev_active.len());
// Filter the set of candidates based on the previously activated
// each one in turn.
let mut last_err = None;
for candidate in my_candidates {
- log!(5, "{}[{}]>{} trying {}", parent.get_name(), cur, dep.get_name(),
+ trace!("{}[{}]>{} trying {}", parent.get_name(), cur, dep.get_name(),
candidate.get_version());
let mut my_cx = cx.clone();
my_cx.resolve.graph.link(parent.get_package_id().clone(),
Err(e) => { last_err = Some(e); }
}
}
- log!(5, "{}[{}]>{} -- {:?}", parent.get_name(), cur, dep.get_name(),
+ trace!("{}[{}]>{} -- {:?}", parent.get_name(), cur, dep.get_name(),
last_err);
// Oh well, we couldn't activate any of the candidates, so we just can't
/// Creates an implementation of `Source` corresponding to this ID.
pub fn load<'a>(&self, config: &'a Config) -> Box<Source+'a> {
- log!(5, "loading SourceId; {}", self);
+ trace!("loading SourceId; {}", self);
match self.inner.kind {
Kind::Git(..) => Box::new(GitSource::new(self, config)) as Box<Source>,
Kind::Path => {
}
pub fn handle_error(err: CliError, shell: &mut MultiShell) {
- log!(4, "handle_error; err={:?}", err);
+ debug!("handle_error; err={:?}", err);
let CliError { error, exit_code, unknown } = err;
let fatal = exit_code != 0; // exit_code == 0 is non-fatal error
pub fn compile(manifest_path: &Path,
options: &CompileOptions)
-> CargoResult<ops::Compilation> {
- log!(4, "compile; manifest-path={}", manifest_path.display());
+ debug!("compile; manifest-path={}", manifest_path.display());
let mut source = try!(PathSource::for_path(&manifest_path.dir_path(),
options.config));
pub fn read_package(path: &Path, source_id: &SourceId, config: &Config)
-> CargoResult<(Package, Vec<Path>)> {
- log!(5, "read_package; path={}; source-id={}", path.display(), source_id);
+ trace!("read_package; path={}; source-id={}", path.display(), source_id);
let mut file = try!(File::open(path));
let data = try!(file.read_to_end());
let mut all_packages = HashSet::new();
let mut visited = HashSet::<Path>::new();
- log!(5, "looking for root package: {}, source_id={}", path.display(), source_id);
+ trace!("looking for root package: {}, source_id={}", path.display(), source_id);
try!(walk(path, |dir| {
- log!(5, "looking for child package: {}", dir.display());
+ trace!("looking for child package: {}", dir.display());
// Don't recurse into git databases
if dir.filename_str() == Some(".git") { return Ok(false); }
if path.is_dir() {
let continues = try!(callback(path));
if !continues {
- log!(5, "not processing {}", path.display());
+ trace!("not processing {}", path.display());
return Ok(());
}
Err(..) => return Ok(false),
};
- log!(5, "old fingerprint: {}", old_fingerprint);
- log!(5, "new fingerprint: {}", new_fingerprint);
+ trace!("old fingerprint: {}", old_fingerprint);
+ trace!("new fingerprint: {}", new_fingerprint);
Ok(old_fingerprint.as_slice() == new_fingerprint)
}
}
}
- log!(5, "rustc jobs completed");
+ trace!("rustc jobs completed");
Ok(())
}
None
});
- log!(5, "commands={}", rustdoc);
+ trace!("commands={}", rustdoc);
let primary = package.get_package_id() == cx.resolve.root();
let name = package.get_name().to_string();
try!(self.config.shell().status("Updating",
format!("git repository `{}`", self.remote.get_url())));
- log!(5, "updating git source `{:?}`", self.remote);
+ trace!("updating git source `{:?}`", self.remote);
let repo = try!(self.remote.checkout(&self.db_path));
let rev = try!(repo.rev_for(&self.reference));
(repo, rev)
}
fn get(&self, ids: &[PackageId]) -> CargoResult<Vec<Package>> {
- log!(5, "getting packages for package ids `{:?}` from `{:?}`", ids,
+ trace!("getting packages for package ids `{:?}` from `{:?}`", ids,
self.remote);
self.path_source.as_ref().expect("BUG: update() must be called \
before get()").get(ids)
impl<'a, 'b> PathSource<'a, 'b> {
pub fn for_path(path: &Path, config: &'a Config<'b>)
-> CargoResult<PathSource<'a, 'b>> {
- log!(5, "PathSource::for_path; path={}", path.display());
+ trace!("PathSource::for_path; path={}", path.display());
Ok(PathSource::new(path, &try!(SourceId::for_path(path)), config))
}
/// in the directory structure reachable by the root manifest.
pub fn new(path: &Path, id: &SourceId, config: &'a Config<'b>)
-> PathSource<'a, 'b> {
- log!(5, "new; id={}", id);
+ trace!("new; id={}", id);
PathSource {
id: id.clone(),
}
pub fn get_root_package(&self) -> CargoResult<Package> {
- log!(5, "get_root_package; source={:?}", self);
+ trace!("get_root_package; source={:?}", self);
if !self.updated {
return Err(internal("source has not been updated"))
}
fn get(&self, ids: &[PackageId]) -> CargoResult<Vec<Package>> {
- log!(5, "getting packages; ids={:?}", ids);
+ trace!("getting packages; ids={:?}", ids);
Ok(self.packages.iter()
.filter(|pkg| ids.iter().any(|id| pkg.get_package_id() == id))
warn!("{} {}", file.stat().map(|s| s.modified).unwrap_or(0), file.display());
max = cmp::max(max, file.stat().map(|s| s.modified).unwrap_or(0));
}
- log!(5, "fingerprint {}: {}", self.path.display(), max);
+ trace!("fingerprint {}: {}", self.path.display(), max);
Ok(max.to_string())
}
}
// git reset --hard origin/master
let reference = "refs/remotes/origin/master";
let oid = try!(repo.refname_to_id(reference));
- log!(5, "[{}] updating to rev {}", self.source_id, oid);
+ trace!("[{}] updating to rev {}", self.source_id, oid);
let object = try!(repo.find_object(oid, None));
try!(repo.reset(&object, git2::ResetType::Hard, None, None, None));
self.updated = true;